package zuoye2;

class Fish{
	int weight;
}
class Lake{
	Fish fish;
	void setFish(Fish s){
		fish = s;
	}
	void eat(int n){
		fish.weight = fish.weight + n;
	}
}
class FishandLake{
	public static void main(String[] args) {
		Fish niqiu = new Fish();
		System.out.println("泥鳅开始重量:"+niqiu.weight);
		Lake taihu  = new Lake();
		taihu.setFish(niqiu);
		taihu.eat(15);
		System.out.println("泥鳅吃完的重量:"+niqiu.weight);
		System.out.println("taihu泥鳅重量:"+taihu.fish.weight);
		Lake dahu  = new Lake();
		dahu.setFish(niqiu);
		dahu.eat(50);
		System.out.println("泥鳅第二次吃完重量:"+niqiu.weight);
		System.out.println("taihu泥鳅第二次吃完重量:"+taihu.fish.weight);
		System.out.println("dahu泥鳅第二次吃完重量:"+dahu.fish.weight);
	}
}


